package com.uenpay.oem.ui.trans.transfer;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.uenpay.oem.R;
import com.uenpay.util.app.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Author: liulou
 * Date: 2017/6/29.
 * desc: 转账结果页面
 */

public class TransferResultActivity extends BaseActivity {


    @BindView(R.id.tv_amount)
    TextView tvAmount;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.btn_complete)
    Button btnComplete;
    @BindView(R.id.tv_msg)
    TextView tvMsg;
    @BindView(R.id.rl_transfer_msg)
    RelativeLayout rlMsg;

    private String mAmount;
    private String mMsg;
    private String mName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setSwipeBackEnable(false);
    }

    @Override
    public View bindView() {
        return null;
    }

    @Override
    public int bindLayout() {
        return R.layout.activity_transfer_result;
    }

    @Override
    public void initView(View view) {
        setTitle("转账成功");
        if (getIntent() != null) {
            mAmount = getIntent().getStringExtra("amount");
            mMsg = getIntent().getStringExtra("msg");
            mName = getIntent().getStringExtra("name");
        }
        if (!TextUtils.isEmpty(mAmount)) {
            tvAmount.setText("¥ " + mAmount);
        }
        if (!TextUtils.isEmpty(mName)) {
            tvName.setText(mName);
        }
        if (!TextUtils.isEmpty(mMsg)) {
            tvMsg.setText(mMsg);
        } else {
            rlMsg.setVisibility(View.GONE);
        }
    }

    @OnClick(R.id.btn_complete)
    public void complete() {
        setResult(RESULT_OK);
        finish();
    }

    @Override
    public void onLeftBtnInTopBarClick() {
        complete();
    }
}
